import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;


public class Submenu extends JFrame {
	
	public Submenu () {
		
		//Menubar
		JMenuBar menubar = new JMenuBar ();
		
		//Menu File
		JMenu file = new JMenu ("File");
		file.setMnemonic(KeyEvent.VK_F);
		
		
		//Menu Import
		JMenu imp = new JMenu("Import");
		imp.setMnemonic(KeyEvent.VK_M);
		
		
		//Cria os submenus de Import
		JMenuItem newsFeed = new JMenuItem("Import newsfeed list...");
		JMenuItem bookMarks = new JMenuItem("Import bookmarks...");
		JMenuItem mail = new JMenuItem ("Import mail...");
		
		
		//Insere os submenus em Import
		imp.add(newsFeed);
		imp.add(bookMarks);
		imp.add(mail);
		
		
		//Menu 'New' do 'File'
		JMenuItem fileNew = new JMenuItem("New");
        fileNew.setMnemonic(KeyEvent.VK_N);

        
        //Menu 'Open' do 'File'
        JMenuItem fileOpen = new JMenuItem("Open");
        fileNew.setMnemonic(KeyEvent.VK_O);

        
        //Menu 'Save' do 'File'
        JMenuItem fileSave = new JMenuItem("Save");
        fileSave.setMnemonic(KeyEvent.VK_S);     

        
        //Menu 'Close' do 'File'
        JMenuItem fileClose = new JMenuItem("Close");
        fileClose.setMnemonic(KeyEvent.VK_C);
        fileClose.setToolTipText("Exit application");
        fileClose.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, 
            ActionEvent.CTRL_MASK));
        fileClose.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent event) {
                System.exit(0);   
            }
        });

        
        //Adiciona os Menus em 'File'
        file.add(fileNew);
        file.add(fileOpen);
        file.add(fileSave);
        file.addSeparator();
        file.add(imp);
        file.addSeparator();
        file.add(fileClose);
        
        
        //Adiciona o Menu 'File' no MenuBar
        menubar.add(file);
        
        
        //Declara o menubar
        setJMenuBar(menubar);
		
        
        //Configuração da Janela
        setSize(360, 250);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setVisible(true);
        
	}
	
	
	
	
}
